<base-grid
    #baseGrid
    (dataReload)="dataReload()"
    (itemClick)="itemClick($event)"
    [addButtonText]="'创建新用户'"
    [afterDetailInit]="afterDetailInit.bind(this)"
    [columns]="columns"
    [customButtons]="customButtons"
    [customCommitMethod]="customCommitMethod.bind(this)"
    [customLoadPageMethod]="customLoadPageMethod.bind(this)"
    [customRemoveMethod]="customRemoveMethod.bind(this)"
    [keyField]="'userId'"
    [nameField]="'userName'"
    [name]="'用户'"
    [popupWidth]="800"
    [recordWrapper]="recordWrapper.bind(this)"
    [schema]="schema"
    [searchForm]="searchForm"
    [showModify]="false"
    [showSort]="true"
    [showTableListChange]="true"
    [showType]="'list'"
    [typeIcon]="typeIcon"
    [usePage]="false"
>
</base-grid>
<ng-template #customButtons>
    <button
        (click)="showImportUserPanel = true"
        *ngIf="baseGrid?.aclEdit"
        [nzType]="'primary'"
        class="user-import-btn"
        nz-button>
        <i nz-icon nzTheme="outline" nzType="dr:hy-import"></i>
        导入用户
    </button>
    <button
        (nzOnConfirm)="resetPassword()"
        *ngIf="baseGrid?.aclEdit && this.baseGrid.checkData.length > 0"
        [nzType]="'primary'"
        nz-button
        nz-popconfirm
        nzCancelText="取消"
        nzOkText="确认"
        nzTitle="是否重置密码?">
        <i nz-icon nzTheme="outline" nzType="dr:hy-reset-password"></i>
        重置密码
    </button>
    <button
        (nzOnConfirm)="unlockPassword()"
        *ngIf="baseGrid?.aclEdit && this.baseGrid.checkData.length > 0"
        nz-button
        nz-popconfirm
        nzCancelText="取消"
        nzOkText="确认"
        nzTitle="是否解锁用户?"
        nzType="primary"
    >
        解锁
    </button>
</ng-template>

<ng-container *ngIf="showImportUserPanel">
    <base-popup
        (closeClick)="showImportUserPanel =false"
        height="490"
        title="导入用户"
        width="550">
        <div class="content">
            <sf
                #sf
                (formSubmit)="importUsers()"
                [button]="'none'"
                [mode]="'edit'"
                [schema]="importSchema"></sf>
        </div>
        <div class="rightBtn">
            <button
                (click)="importUsers()"
                [disabled]="!sf?.valid"
                [nzType]="'primary'"
                nz-button>导入
            </button>
            <button (click)="showImportUserPanel = false" [nzType]="'default'" nz-button>取消</button>
        </div>
    </base-popup>
</ng-container>
